
 
 F u n c t i o n :   e x t e n d ( b o o l I s D e e p ,   O b j e c t 1 ,   O b j e c t 2 ,   E t c .   ) 
 
 
 
 D e s c r i p t i o n :   E x t e n d s   a n   o b j e c t   b y   m e r g i n g   a l l   s u b s e q u e n t   o b j e c t   p r o p e r t i e s   a n d   m e t h o d s   i n t o   t h e   f i r s t   o b j e c t . 
 
 
 
 R e t u r n s :   T a r g e t   O b j e c t . 
 
 
 
 N o t e :   W h e n   b o o l I s D e e p   i s   s e t   t o   t r u e ,   d e e p   r e c u r s i o n   w i l l   p a r s e   a l l   c h i l d   o b j e c t   b r a n c h e s   w i t h i n   e a c h   o b j e c t   t o   m e r g e ,   o t h e r w i s e   o n l y   t h e   f i r s t   l e v e l   i s   p a r s e d .   T h e   f i r s t   o b j e c t   i s   a l w a y s   t h e   m e r g e   t a r g e t ,   a n d   a l l   s u b s e q u e n t   o b j e c t s   p a s s e d   a s   a d d i t i o n a l   a r g u m e n t s   w i l l   b e   m e r g e d   i n t o   t h e   f i r s t   o b j e c t .   S u p p o r t e d   o b j e c t   t y p e s   i n c l u d e   t h o s e   o f   t y p e   O b j e c t   a n d   F u n c t i o n .   I f   o n l y   o n e   o b j e c t   i s   p a s s e d   t o   t h e   e x t e n d ( )   f u n c t i o n ,   t h e n   a l l   p r o p e r t i e s   a n d   m e t h o d s   w i t h i n   t h a t   o b j e c t   w i l l   b e   m e r g e d   i n t o   t h e   $ A   o b j e c t   t o   e x t e n d   4 X .   A l l   p r o p e r t i e s   a n d   m e t h o d s   w i t h   t h e   s a m e   n a m e   w i l l   b e   o v e r w r i t t e n   w i t h i n   t h e   t a r g e t   o b j e c t   i f   p r e s e n t .   T h e   e x t e n d ( )   f u n c t i o n   i s   o r i g i n a l l y   d e r i v e d   f r o m   t h e   s a m e   f u n c t i o n   w i t h i n   j Q u e r y . 
 
 
 
 E x a m p l e : 
 
 
 
 v a r   o b j e c t 1   =   { o r i g i n P r o p :   " o r i g i n V a l u e " } ; 
 
 v a r   o b j e c t 2   =   { n e w P r o p :   " n e w V a l u e " } ; 
 
 v a r   o b j e c t 3   =   { l a s t P r o p :   " l a s t V a l u e " } ; 
 
 
 
 / /   P e r f o r m   a   s h a l l o w   m e r g e   f r o m   o n e   o b j e c t   i n t o   a n o t h e r . 
 
 $ A . e x t e n d ( o b j e c t 1 ,   o b j e c t 2 ) ;   / /   o b j e c t 1   i s   e x t e n d e d 
 
 
 
 / /   P e r f o r m   a   d e e p   m e r g e   f r o m   o n e   o b j e c t   i n t o   a n o t h e r . 
 
 / /   A p p l i c a b l e   w h e n   a n   o b j e c t   i n c l u d e s   c h i l d   o b j e c t s . 
 
 $ A . e x t e n d ( t r u e ,   o b j e c t 1 ,   o b j e c t 2 ) ;   / /   o b j e c t 1   i s   e x t e n d e d 
 
 
 
 / /   P e r f o r m   a   c o n s e c u t i v e   s h a l l o w   m e r g e   f r o m   m u l t i p l e   o b j e c t s   i n t o   t h e   f i r s t . 
 
 $ A . e x t e n d ( o b j e c t 1 ,   o b j e c t 2 ,   o b j e c t 3 ) ;   / /   o b j e c t 1   i s   e x t e n d e d 
 
 
 
 / /   P e r f o r m   a   c o n s e c u t i v e   d e e p   m e r g e   f r o m   m u l t i p l e   o b j e c t s   i n t o   t h e   f i r s t . 
 
 $ A . e x t e n d ( t r u e ,   o b j e c t 1 ,   o b j e c t 2 ,   o b j e c t 3 ) ;   / /   o b j e c t 1   i s   e x t e n d e d 
 
 
 
 / /   P e r f o r m   a   s h a l l o w   m e r g e   i n t o   t h e   $ A   o b j e c t   t o   e x t e n d   4 X . 
 
 $ A . e x t e n d ( o b j e c t 1 ) ;   / /   $ A   i s   e x t e n d e d 
 
 
 
 / /   P e r f o r m   a   d e e p   m e r g e   i n t o   t h e   $ A   o b j e c t   t o   e x t e n d   4 X . 
 
 $ A . e x t e n d ( t r u e ,   o b j e c t 1 ) ;   / /   $ A   i s   e x t e n d e d 
 
 